#include "win_utils.h"

int APIENTRY WinMain(HINSTANCE hInstance,
	HINSTANCE         hPrevInstance,
	LPSTR             lpCmdLine,
	int               nCmdShow)
{
	LPCTSTR lpzClass = TEXT("Map");

	if (!RegMyWindowClass(hInstance, lpzClass))
		return 1;

	RECT screen_rect;
	GetWindowRect(GetDesktopWindow(), &screen_rect);
	int x = screen_rect.right / 2 - 400;
	int y = screen_rect.bottom / 2 - 225;

	HWND hWnd = CreateWindow(lpzClass, TEXT("Map"), 
		WS_OVERLAPPEDWINDOW | WS_VISIBLE, x, y, 800, 550, NULL, NULL, 
		hInstance, NULL);

	if(!hWnd) return 2; 

	MSG msg = {0};
	int iGetOk = 0;
	while ((iGetOk = GetMessage(&msg, NULL, 0, 0 )) != 0) 
	{
		if (iGetOk == -1) return 3;  
		TranslateMessage(&msg);    
		DispatchMessage(&msg);
	}

	return msg.wParam;  
}

